package com.wrk._1_语法._04_循环._01_单循环;

public class _003_求1到n的和小于8888的最大正整数n {
    public static void main(String[] args){
        //定义变量
        int sum =0;
        int n;
        //循环
        for (n = 0;sum<8888;n++){
            sum=sum+n;
        }
        if (sum>8888){
            n--;
            sum=sum-n;
        }
        System.out.println("sum="+sum);
        System.out.println(n);
    }
}
